package cn.superchart.web.core.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.event.AuthenticationFailureLockedEvent;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ScAuthenticationLockHandler implements ApplicationListener<AuthenticationFailureLockedEvent> {


    @Override
    public void onApplicationEvent(AuthenticationFailureLockedEvent event) {
        UsernamePasswordAuthenticationToken authenticationToken = (UsernamePasswordAuthenticationToken) event.getSource();
        String account = (String) authenticationToken.getPrincipal();
        log.info("账户：{} 已被锁定",account);
    }
}
